package banking;

import java.util.ArrayList;
import java.util.List;

public class Customer {
    private String firstName;
    private String lastName;
    private final List<Account> accountsList = new ArrayList<>();

    public Customer(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public Account getAccount(int index) {
        return accountsList.get(index);
    }

    public void addAccount(Account account) {
        if (accountsList.size() < 5){
            accountsList.add(account);
        }else {
            System.out.println("每人不得超过5个账户!");
        }
    }

    public int getNumOfAccounts() {
        return accountsList.size();
    }
}
